package oracle;

import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.sql.Connection;

import org.firefly.db.dialect.IDialect;
import org.firefly.db.dialect.OracleDialect;
import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class EadpDemo {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Class.forName("net.sourceforge.jtds.jdbc.Driver");
		Connection srcConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.1.5:1433/eadp4", "sa", "eplugger");
		try {
			DBInfo srcInfo = new DBInfo(srcConn, "EADPDEMO", DBName.SqlServer2005);
			IDialect tarDia = new OracleDialect();
			FileOutputStream fos = new FileOutputStream("/Users/firefly/Desktop/meta.sql");
			OutputStreamWriter osw = new OutputStreamWriter(fos);
			DBUtils.expertInsertSQL(srcInfo, tarDia, osw, new String[]{"SYS_ENTITY_META"}, " where beanid in ('sysModule','sysMenu','sysParam','sysAuthority','categoryEntry','categoryTab','concurrent')", true);
		} finally{
			srcConn.close();
		}
	}
}
